package com.weixin.paleituo.adapter;

/**
 * Author yichao
 * Time  2017/12/12 15:57
 * Dest  主页热门楼盘
 */

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.application.BaseApplication;
import com.weixin.paleituo.bean.RecommendhouseBean;
import com.weixin.paleituo.util.UIUtils;

import java.util.List;

public class HomeFragmentHorizontalScrollViewAdapter extends AbHorizontalScrollViewAdapter<RecommendhouseBean>
{



    public HomeFragmentHorizontalScrollViewAdapter(Context context, List<RecommendhouseBean> recommendhouseBeanList)
    {
        super(context, recommendhouseBeanList);

    }

    public View getView(final int position, View convertView, ViewGroup parent)
    {
        ViewHolder viewHolder = null;
        if (convertView == null)
        {
            viewHolder = new ViewHolder();
            convertView = mInflater.inflate(
                    R.layout.item_house_hot, parent, false);
            viewHolder.mImg = (ImageView) convertView
                    .findViewById(R.id.iv_item_house_hot);
            viewHolder.mTvName = (TextView) convertView
                    .findViewById(R.id.tv_name_house_hot);
            viewHolder.mTvArea = (TextView) convertView
                    .findViewById(R.id.tv_housearea_house_hot);
            viewHolder.mTvPrice=convertView.findViewById(R.id.tv_houseprice_house_hot);
          viewHolder.mLinearLayout=  convertView.findViewById(R.id.ll_root_item_house_hot);

            convertView.setTag(viewHolder);
        } else
        {
            viewHolder = (ViewHolder) convertView.getTag();
        }
      //  Glide.with(BaseApplication.mContext).load(mTS.get(position).getImgurl()).into(viewHolder.mImg);
        UIUtils.loadImageViewRoud(BaseApplication.mContext,mTS.get(position).getImgurl(),viewHolder.mImg,UIUtils.getDimens(R.dimen.dp_2));
       // viewHolder.mImg.setImageResource(mTS.get(position).getImgurl());
        viewHolder.mTvName.setText(mTS.get(position).getName());
        //viewHolder.mTvArea.setText(mTS.get(position).getArearange()+"");

        int soldStatus = mTS.get(position).getSoldStatus();

        UIUtils.showPrice(soldStatus,viewHolder.mTvPrice,mTS.get(position).getMoney()+"");



      //  viewHolder.mTvPrice.setText(mTS.get(position).getMoney()+"");

        return convertView;
    }
    private class ViewHolder
    {
        ImageView mImg;
        TextView mTvName,mTvArea,mTvPrice;
        LinearLayout mLinearLayout;

    }

}

